<template>
    <div>
        <div class="card2" v-for="(item, index) in data" :key="index" @click="toCourseInfo(item.id)">
            <div class="title">{{item.title}}</div>
            <div class="hour">{{item.total_periods}}课时</div>
            <div v-for="(key, i) in item.teachers_list" :key="i">
                <div class="teacher border-bottom">
                    <img :src="key.teacher_avatar" alt="">
                    {{key.teacher_name}}
                </div>
            </div>
            <div class="qita">
                <div class="people">{{item.sales_num}}人已报名</div>
                <div class="money" v-if="item.price==0">免费</div>
                <div class="money1" v-else>
                    <van-icon name="gold-coin-o" />
                    <span>
                        {{item.price}}.00
                    </span>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        props:["data"],
        methods:{
            toCourseInfo(id){
                this.$emit("toCourseInfo",id)
            }
        }
    }
</script>

<style lang="scss" scoped>
.card2{
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    background: white;
    border-radius: 10px;
    margin-top: 10px;
    .title{
        font-size: 16px;
        margin-bottom: 5px;
    }
    .hour{
        font-size: 13px;
        color: rgb(150, 150, 150);
        margin-bottom: 5px;
    }
    .teacher{
        width: 100%;
        height: 50px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid rgb(230, 230, 230);
        color: rgb(150, 150, 150);
        img{
            width: 30px;
            height: 30px;
            border-radius: 30px;
            padding: 5px;
        }
    }
    .qita{
        width: 100%;
        height: 40px;
        display: flex;
        justify-items:center ;
        justify-content: space-between;
        color: rgb(150, 150, 150);
        div{
            height: 40px;
            line-height: 49px;
        }
        .money{
            color: rgb(105, 158, 27);
            font-size: 15px;
        }
        .money1{
            
            font-size: 15px;
            .van-icon{
                color: orange;
                vertical-align: middle;
            }
            span{
                color:red;
                vertical-align: middle;
            }
        }
    }
}
</style>